package conson.tech.manage.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import conson.tech.manage.api.app.dto.ChannelIconConfigDTO;
import conson.tech.manage.common.util.EntityUtils;
import conson.tech.manage.app.entity.pojo.ChannelAdvert;
import conson.tech.manage.app.entity.pojo.ChannelIconConfig;
import conson.tech.manage.app.mapper.ChannelIconMapper;
import conson.tech.manage.app.service.ChannelIconService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: ChannelIconServiceImpl
 * Description:
 * Author: HXL
 * Date: 2020/4/22 3:47 下午
 * Version: 1.0
 */
@Service("channelIconService")
public class ChannelIconServiceImpl implements ChannelIconService {
    @Autowired
    private ChannelIconMapper channelIconMapper;

    @Override
    public List<ChannelIconConfigDTO> queryIconByChannelCode(String channelCode) {

        QueryWrapper query = new QueryWrapper();
        ChannelIconConfig iconConfig = new ChannelIconConfig();
        iconConfig.setChannelCode(channelCode);
        iconConfig.setDelFlag(1);
        query.setEntity(iconConfig);
        List<ChannelAdvert> advertList = channelIconMapper.selectList(query);
        return EntityUtils.listToList(advertList, ChannelIconConfigDTO.class);
    }
}
